<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/10/20
 * Time: 16:10
 */

namespace app\api\model;


use think\Model;

class Order extends Model
{
    protected $autoWriteTimestamp = true;
    protected $createTime = 'add_time';
    protected $field = true;
    public function getContactArrt($val){
        $arr = implode(',',$val);
        switch ($arr[0]){
            case '1':
                return array('contact' => 1,'type' => '堂食','talk' =>array('phone' => $arr[1],'address'=> 0));
                break;
            case '2':
                $address = db('user_address')->where('address_id','=',$arr[0])->find();
                return array('contact' => 2,'type' => '外卖','talk'=>array('phone' => $address['phone'],'address'=> $address['address']));
                break;
            default :
                return array('contact' => 0,'type' => '未知','talk' =>array('phone' => 0,'address'=> 0));
                break;
        }
    }
}